home *** CD-ROM | disk | FTP | other *** search
/ Deutsche Edition 1 / Deutsche Edition 1.iso / amok / 011-020 / amok19 / qtext / qtext.asm < prev    next >
Assembly Source File  |  1993-11-04  |  3KB  |  123 lines

  1. ;*---------------------------------------------------------------------------
  2. ;  :Program.    QText.ASM
  3. ;  :Contents.   Procedure for fast text-output on a BitMap
  4. ;  :Author.     Fridtjof Siebert
  5. ;  :Address.    Nobileweg 67, D-7-Stgt-40
  6. ;  :Phone.      (0)711/822509
  7. ;  :Shortcut.   [fbs]
  8. ;  :Version.    1.0
  9. ;  :Date.       29-Apr-89
  10. ;  :Copyright.  Publik Domain
  11. ;  :Language.   68000 Assembler
  12. ;  :Translator. M2Amiga v3.1d / Profimat
  13. ;  :Remark.     Sorry. This compiles only under m2c V3.1d, but
  14. ;  :Remark.     this is imported by MuchMore, and I don't want
  15. ;  :Remark.     to recompile MuchMore! [fbs]
  16. ;---------------------------------------------------------------------------*
  17.  
  18. ; BitMap:
  19. bm_BytesPerRow = 0
  20. bm_Rows        = 2
  21. bm_Flags       = 4
  22. bm_Depth       = 5
  23. bm_Pad         = 6
  24. bm_Planes      = 8
  25. bm_SIZEOF      = 40
  26.  
  27. ; TextFont:
  28. tf_YSize      = 20
  29. tf_Style      = 22
  30. tf_Flags      = 23
  31. tf_XSize      = 24
  32. tf_Baseline   = 26
  33. tf_BoldSmear  = 28
  34. tf_Accessors  = 30
  35. tf_LoChar     = 32
  36. tf_HiChar     = 33
  37. tf_CharData   = 34
  38. tf_Modulo     = 38
  39. tf_CharLoc    = 40
  40. tf_CharSpace  = 44
  41. tf_CharKern   = 48
  42. tf_SIZEOF     = 52
  43.  
  44. ;* d0 - horizontal position  (text position, not pixel position)
  45. ;* d1 - vertical position    (pixel position)
  46. ;* a0 - Pointer to String (0C-Termination)
  47. ;* a1 - Pointer to BitMap to store String
  48. ;* a2 - Pointer to TextFont
  49.  
  50. QText:
  51.   movem.l     d0-d3/a0-a3,-(sp)      ;save used registers
  52.   move        bm_bytesPerRow(a1),d2;
  53.   ext.l       d2;
  54.   mulu        d2,d1;
  55.   ext.l       d0;
  56.   add.l       d0,d1;
  57.   move.l      bm_Planes(a1),a1 ;Position in BitMap to a1
  58.   add.l       d1,a1;
  59.   move.l      d2,d1;
  60.   asl.l       #3,d1;
  61.   sub.l       d2,d1;
  62.   subq.l      #1,d1;
  63.   move.l      tf_CharData(a2),a2  ;get addr of the font data
  64.  
  65. \loop:
  66.   move.b      (a0)+,d0;           ; get character
  67.   beq         return;
  68.  
  69.   move.b      d0,d3;
  70.   and.b       #$60,d3;            ; unknown char?
  71.   bne         \knownchar;
  72.  
  73.   move.b      #$fe,(a1)
  74.   add.l       d2,a1;
  75.   move.b      #$c6,(a1);
  76.   add.l       d2,a1;
  77.   move.b      #$c6,(a1);
  78.   add.l       d2,a1;
  79.   move.b      #$c6,(a1);
  80.   add.l       d2,a1;
  81.   move.b      #$c6,(a1);
  82.   add.l       d2,a1;
  83.   move.b      #$c6,(a1);
  84.   add.l       d2,a1;
  85.   move.b      #$fe,(a1);
  86.   add.l       d2,a1;
  87.   move.b      #$00,(a1);
  88.   sub.l       d1,a1;
  89.   bra         \loop;
  90.  
  91. \knownchar:
  92.   sub.b       #$20,d0;
  93.   bpl.s       \special;
  94.   sub.b       #$20,d0;
  95.  
  96. \special:
  97.   and.w       #$ff,d0;
  98.   lea         0(a2,d0.w),a3;
  99.  
  100.   move.b      (a3),(a1)
  101.   add.l       d2,a1
  102.   move.b      $c0(a3),(a1)
  103.   add.l       d2,a1
  104.   move.b      $180(a3),(a1)
  105.   add.l       d2,a1
  106.   move.b      $240(a3),(a1)
  107.   add.l       d2,a1
  108.   move.b      $300(a3),(a1)
  109.   add.l       d2,a1
  110.   move.b      $3c0(a3),(a1)
  111.   add.l       d2,a1
  112.   move.b      $480(a3),(a1)
  113.   add.l       d2,a1
  114.   move.b      $540(a3),(a1)
  115.   sub.l       d1,a1;
  116.   bra         \loop;
  117.  
  118. return:
  119.   movem.l     (sp)+,d0-d3/a0-a3; restore regs
  120.   rts;
  121.   END;
  122.  
  123.